# -*- coding:utf-8 -*-
# @Author:🎈RedBalloon
# @Time:2022/10/2-16:37
# @File:19-requests的使用5.py
import requests
from fake_useragent import UserAgent

# requests的session的使用

# 创建一个session对象
session = requests.Session()
url = "https://www.qbiqu.com/login.php?do=submit&jumpurl=http%3A%2F%2Fwww.qbiqu.com%2Fuserdetail.php%3Fuid%3Dundefined"
form_data = {
    "username": "redballoon",
    "password": "123456",
    "usecookie": 0,
    "action": "login"
}

headers = {
    "User-Agent": UserAgent().random,
}
response = session.post(url, headers=headers, data=form_data)
response.encoding = 'gbk'
# print(response.text)

myinfo_page = "https://www.qbiqu.com/userdetail.php?uid=undefined"
myinfo_html = session.post(myinfo_page, headers=headers)
myinfo_html.encoding = 'gbk'
print(myinfo_html.text)  # 欢迎您：redballoon
